<!DOCTYPE html>
<html>

<head>
    <title>我的消息</title>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="/js/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="/js/bootstrap/css/bootstrap.css">
    <script src="/js/jquery/jquery.min.js"></script>
    <script src="/js/bootstrap/js/bootstrap.min.js"></script>
    <script src="/js/common.js"></script>
    <link rel="stylesheet" href="/css/font/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="/css/reset.css"/>
    <link rel="stylesheet" href="/css/message.css"/>
    <script>
        var id = getParams().id;
        var types = getParams().type;
        var Ids;
        var str;
        var Html;
        $(function () {
            var li =$(".list-group li:first").clone();
            $.get("/"+types,{types:types,id:id},function (data) {
                if(types=="likes"){
                    str="赞了";
                }else if(types=="review"){
                    str="评论了"
                }
                $.each(data,function (index, ele) {
                    var row = li.clone();
                    Html = "<span>"
                        +ele.user.nickName+"</span>"+str+"你的"+ele.travel.title;
                    if(types=="review"){
                        Html = Html +"<br><span style=\"color: #fb1e48\">"+"内容:"+ele.content+"</span>";
                    }else{
                        Html = Html +"<p>  </p>"
                    }
                    console.log(Html);

                    Ids = ele.travel.id;
                   /* $.get("/"+types+"/unread/"+id,function (unread) {
                        $.each(unread,function (i, e) {

                            if(ele.contentId.author.id==e.user_id &&
                                ele.contentId.id == e.content_id &&
                                ele.time == e.time
                            ){
                                Html = Html +"<p style=\"float: right; margin-right: 5px\"><i  class=\"fa fa-star fa-2x\"></i></p>";
                            }
                        })
                        console.log(Html);
                    })*/

                    Html = Html +"<p style='float: right;margin-right: 5px'>"+ele.createtime+"</p>";
                    row.find("span")[0].innerHTML=Html;
                    row.appendTo(".list-group");



                    $.ajax({
                        url:"/"+types+"/changeState/"+Ids,
                        type: "PUT"
                    })

                })
                $(".list-group li:first").remove();
            })

        })
    </script>
</head>

<body>
<div class="search-head">
    <div class="row nav-search">
        <div class="col">
            <a href="javascript:history.go(-1);">
                <span><i class="fa fa-chevron-left"></i></span>
            </a>
        </div>
        <div class="col">
            <span>我的消息</span>
        </div>
        <div class="col"></div>
    </div>
</div>

<ul class="list-group">
    <li class="list-group-item d-flex justify-content-between align-items-center">
        <div class="item">
            <span>
            </span>
        </div>
    </li>
</ul>
</body>

</html>